<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>百度地图测试一下</title>
    <script src="https://www.echartsjs.com/examples/vendors/jquery/jquery.js"></script>
    <script src="https://www.echartsjs.com/examples/vendors/echarts/echarts.min.js?_v_=1571424732409"></script>
    <script src="js/echarts_map.js"></script>
</head>
<body>
<button id="back_id">返回上级</button>
<div id="main" style="width: 1200px;height:900px;"></div>
</body>
<script>
    var datas = function(){
        var data = [];
        /*for(var i=0;i<Math.round(Math.random()*10)+10;i++) {
            var a = Math.round(Math.random()*1000);
            data.push(a);
            console.log(a);
        }*/
        data.push({name:'四川',value:200})
        return data;
    }

     var option = {
            title: {
                text: '贵州纪检监察线索处理',
                left: 'center'
            },
            tooltip: {
                trigger: 'item',
                formatter: function(a){
                    return '显示具体的'
                }
            },
            visualMap:{
                type:'piecewise',
                inRange: {
                    color: ['#FFF0F5', '#800000']
                },
                pieces: [
                    {min: 100000}, // 不指定 max，表示 max 为无限大（Infinity）。
                    {min: 50000, max: 100000},
                    {min: 10000, max: 50000},
                    {min: 1000, max: 10000},
                    {max: 1000}     // 不指定 min，表示 min 为无限大（-Infinity）。
                ],
                calculable: true,
                show:true
            },
            series:[{
                type: 'map',
                label:{
                    show:true
                },
                itemStyle:{
                    areaColor: '#F8F8FF'
                },
                emphasis:{
                    itemStyle:{
                        areaColor: '#F8F8FF'
                    }
                }
            }]
        };
    var mp = $("#main").chartMap(option);

    

    mp.setData({name:'guizhou',url:'mapdata/json/china.json',data:datas()});


    setTimeout(function(){


    },200)
    

    mp.on('click', function (params) {

    });

    mp.on('dblclick', function (params) {
        console.log(params.name);
    });

    $("#back_id").on("click",function(){
        var option = {
            title: {
                text: '贵州纪检监察线索处理',
                left: 'center'
            },
            visualMap:{
                type:'piecewise',
                inRange: {
                    color: ['#FFF0F5', '#800000']
                },
                calculable: false,
                show:true
            }
        };

        mp.setOption(option);
    });
</script>
</html>